import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/process/daily_bottom_sheet.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/risk_control/daily_commitment_detail_approve/daily_commitment_detail_approve_controller.dart';

///每日承诺审签
class DailyCommitmentDetailApprovePage extends StatelessWidget {
  DailyCommitmentDetailApprovePage({super.key});

  final controller = Get.put(DailyCommitmentDetailApproveController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Scaffold(
            appBar: CustomAppBar(
              titleText: '每日承诺审签',
            ),
            body: Container(
              alignment: Alignment.topCenter,
              color: const Color(0xffF5F5F6),
              child: SingleChildScrollView(
                child: Column(
                  children: [
                    Container(
                      height: 38.w,
                      alignment: Alignment.centerLeft,
                      padding: EdgeInsets.only(left: 16.w, right: 16.w),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          SizedBox(
                            width: 120.w,
                            child: Text(
                              '基本信息',
                              style: TextStyle(
                                fontSize: 13.sp,
                                height: 1.2,
                                fontWeight: FontWeight.w400,
                                color: const Color(0xffA0A7B5),
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                    Container(
                      height: 2.w,
                      color: const Color(0xFF587DF5),
                    ),
                    Container(
                      color: Colors.white,
                      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.w),
                      child: SingleChildScrollView(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            _getTextView(title: '生产装置套数：', value: '${controller.data?.deviceCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '运行套数：', value: '${controller.data?.runCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '停车套数：', value: '${controller.data?.stopCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '特级动火作业：', value: controller.data?.superLevelHotWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '一级动火作业：', value: controller.data?.oneLevelHotWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '二级动火作业：', value: controller.data?.twoLevelHotWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '断路作业：', value: controller.data?.circuitWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '动土作业：', value: controller.data?.soilWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '高处作业：', value: controller.data?.highWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '临时用电作业：', value: controller.data?.electricityWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '吊装作业：', value: controller.data?.hoistingWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '盲板作业：', value: controller.data?.plateWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '受限空间作业：', value: controller.data?.spaceWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '检维修作业：', value: controller.data?.inspectWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '倒灌作业：', value: controller.data?.pourWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '清罐作业：', value: controller.data?.unmixedWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '切水作业：', value: controller.data?.waterWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '承包商作业：', value: controller.data?.contractorWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '变更作业：', value: controller.data?.changeWork ?? ''),
                            AppGaps.vGap10,
                            _getTextView(title: '是否有承包商作业：', value: controller.data?.isContractorWork=='1'?'是':'否'),
                            AppGaps.vGap10,
                            _getTextView(title: '是否处于试生产期：', value: controller.data?.production==1?'是':'否'),
                            AppGaps.vGap10,
                            _getTextView(title: '是否处于开停车阶段：', value: controller.data?.isOpenStop==1?'是':'否'),
                            AppGaps.vGap10,
                            _getTextView(title: '正在开停车装置数：', value: '${controller.data?.openOrStopCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '开车装置数：', value: '${controller.data?.openDeviceCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '停车装置数：', value: '${controller.data?.stopDeviceCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '是否开展中（扩）试：', value: controller.data?.isDevelop ==1?'是':'否'),
                            AppGaps.vGap10,
                            _getTextView(title: '试生产装置数：', value: '${controller.data?.produceDeviceCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '检维修套数：', value: '${controller.data?.inspectCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '重点监管危险工艺数量：', value: '${controller.data?.technologyCount ?? ''}'),
                            AppGaps.vGap10,
                            _getTextView(title: '有无重大隐患：', value: '${controller.data?.bigHiddenDanger ?? ''}'),
                            SizedBox(height: 210.w),
                          ],
                        ),
                      ),
                    )
                  ],
                ),
              ),
            ),
            bottomSheet: DailyApprovalBottomSheet(
              onOpinion: controller.onOpinion,
              onSign: controller.onSign,
              onOperation: controller.onOperation,
            ),
          );
        });
  }

  /// 获取一行字段显示
  Widget _getTextView({required String title, required String value, Color? valueColor}) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        SizedBox(
          width: 150.w,
          child: Text(
            title,
            style: TextStyle(
              fontSize: 13.sp,
              height: 1.2,
              fontWeight: FontWeight.w400,
              color: const Color(0xffA0A7B5),
            ),
          ),
        ),
        Expanded(
            child: Text(
          value,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w400,
            color: valueColor ?? const Color(0xff495061),
          ),
        ))
      ],
    );
  }
}
